# Maximum Clique Problem最大团问题
# 回溯法，深度优先
import copy


def Max_Clique(t):
    global bestx  # 最大团节点编号
    global bestn  # 最大团节点数
    if t >= n:
        sum = 0
        for value in x:
            sum = sum + value
        if sum > bestn:
            bestx = copy.deepcopy(x)
            bestn = sum
    else:
        # 判断与当前节点是否形成团
        flag = 1
        for i in range(0, t):
            if x[i] == 1 and G_list[t][i] == '0':
                flag = 0
        if flag == 0:
            x[t] = 0
            Max_Clique(t + 1)
        else:
            for j in range(0, 2):
                x[t] = j
                Max_Clique(t + 1)


if __name__ == '__main__':
    # 输入一个图，用二维数组存储
    G_list = []
    data = input()
    try:
        while data:
            G_list.append(data.split(','))
            data = input()
    except EOFError as e:
        print()

    finally:

        a = G_list
        n = len(a)
        x = [i for i in range(n)]
        bestx = None
        bestn = 0
        Max_Clique(0)
        print("最大团顶点个数：", bestn)
        print("最大团为：", bestx)